import { requestClient } from '#/api/request';

export interface AnnouncementParams {
  id?: number;
  title: string;
  type: string;
  content: string;
}
// 修改系统公告信息
export async function updateAnnouncementApi(data: AnnouncementParams) {
  return requestClient.post('/system/update-sys-ann', data);
}

// 创建系统公告信息
export async function createAnnouncementApi(data: AnnouncementParams) {
  return requestClient.post('/system/create-sys-ann', data);
}

// 发布系统公告
export async function publishAnnouncementApi(id: string) {
  return requestClient.patch(`/system/publish-sys-ann`, { id });
}

// 查询系统公告分页列表
export async function getAnnouncementListApi(params: any) {
  return requestClient.get('/system/get-sys-ann-list', { params });
}

// 查看公告详情
export async function getAnnouncementDetailApi(annId: string) {
  return requestClient.get(`/system/get-sys-ann-detail/${annId}`);
}

// 删除系统公告信息
export async function deleteAnnouncementApi(data: AnnouncementParams) {
  return requestClient.delete(`/system/delete-sys-ann/${data.id}`);
}
